<template>
  <div id="app" @mouseover="OperatingWebsite">
    <router-view/>
  </div>
</template>

<script>
  export default {
    name: 'App',
    data() {
      return {
        currentTime: new Date().getTime()
      };
    },
    methods: {
      OperatingWebsite:function () {
        let currentTime = this.currentTime;
        let lastTime = new Date().getTime();
        let timeOut = 10 * 60 * 1000; //设置时间 10分钟
        if (lastTime - currentTime > timeOut) {
          // 未操作页面
          this.$alert('您已经超过10分钟未浏览该页面, 请刷新页面', '提醒', {
            showCancelButton:false,
            showClose:false,
            confirmButtonText: '确定',
            type: 'warning'
          }).then(() => {
            location.reload()
          });
        } else {
          this.currentTime = new Date().getTime();
        }
      }
    },
  }
</script>

<style>
  #app {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
</style>
